<%@ page language="java" import="java.util.*,javax.servlet.http.Cookie" pageEncoding="UTF-8"%>
<link rel="stylesheet" type="text/css" href="/stusys/css/title_login.css">
<script src="/stusys/js/login.js" type="text/javascript"></script> 
<%
 Cookie[] cookies=request.getCookies();
    String name=null;
    name=(String)request.getSession().getAttribute("userid");
    String unread="";
    if(cookies==null)
    	System.out.println("none any cookie");
    
    else {
    	try{
    		if(cookies.length==0)
    			System.out.println("can't write cookie");
    		else{
    			for(int i=0;i<cookies.length;i++){    	 
    				
    				if(cookies[i].getName().equals("unread"))
    					unread=cookies[i].getValue();
    			}
    		}
    		
    	}catch( Exception e){
    		System.out.println(e);
    	}
    	
    }
 
  if(unread.equals("null"))
      unread="0";
    
        %>
   <div class='title' id='fixed'>
   <div id="index" style="position:absolute"><a href="/stusys/index.jsp">首页</a></div>
     <div id='useinfo'>
     <% 
      if(name==null){%>
       <span style="color:red" id="tip">您还没登录！</span>
       <a href='javascript:void(0);' id='lgbutton'>登录</a>|
       <a href='register.jsp' id='regbutton'><span>注册</span></a>|    
     <%}   
     else {%>   
       <a href='/stusys/servlet/User_info' id='name'><span><%=name %></span></a>|      
       <a href='/stusys/servlet/User_news' id='unread'><span>消息(<%=unread %>)</span></a>|
       <a href='/stusys/servlet/Exit' id='exit'><span>退出</span></a>
  <%}%>    
    <a href='javascript:void(0);' id='help'><span>帮助</span></a>       
     </div>
    </div> 
   <%if(name==null)  
      {%>      
   
   <div id="bg"></div>
   <div id="login">  
     <div id="closelg"><a href="javascript:void(0);">关闭</a></div>
     <div id="onlogin">
          <form id="lgdata"  action="#" method="post" name="lg">
            <table>
             <tr>
              <td class="td_font">用户名：</td>
              <td><input class="npinput" id="userid" type="text" maxlength="20" name="userid"/></td>
             </tr> 
             <tr>
              <td class="td_font">密码：</td>
              <td><input class="npinput"  id="password" type="password" maxlength="50" name="password"/></td>
              <td><span id="pserror">用户名或密码错误！</span></td>
             </tr> 
             <tr>
               <td></td>
               <td><input class="npinput"id="verity" type="text" maxlength="4" name="verity"/></td>
               <td><img src="" id="verityimg"/><a href="javascript:void(0);" id="getverity" >换张图片</a></td> 
               <td><span id="vrtyerror">验证码错误！</span></td>            
             </tr>  
             <tr>
               <td></td>
               <td><div id="loading">loading</div><a href="javascript:void(0);" id="alogin"><span>登录</span></a><a href="javascript:void(0);" id="getps" >忘记密码？</a></td>
               
             </tr>    
            </table>
         </form>
         </div><!-- id=onlogin -->
         
       </div>
     <%} %> 
     